package com.web.hawaste.controller;


import com.web.hawaste.service.ISysUserRoleService;
import com.web.hawaste.utils.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.Arrays;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author Suzy
 * @since 2022-09-26
 */
@RestController
@RequestMapping("/manager/role")
public class SysUserRoleController {
    @Autowired
    ISysUserRoleService sysUserRoleService;

    /**
     * 方法名: deleteBatch
     * 描述: 批量删除角色的已选用户
     *
     * @param rid
     * @param ids
     * @return com.web.hawaste.utils.ResultBean
     * @date 2022/10/12 22:54
     * @auther YangSuzy
     **/
    @RequestMapping("deleteBatch")
    public ResultBean deleteBatch(long rid, Long[] ids) {
        return ResultBean.ok(sysUserRoleService.deleteBatch(rid, ids));
    }

    /**
     * 方法名: insertBatch
     * 描述: 批量分配用户
     *
     * @param rid
     * @param ids
     * @return com.web.hawaste.utils.ResultBean
     * @date 2022/10/12 22:56
     * @auther YangSuzy
     **/
    @RequestMapping("insertBatch")
    public ResultBean insertBatch(long rid, Long[] ids) {
        return ResultBean.ok(sysUserRoleService.insertBatch(rid, Arrays.asList(ids)));
    }
}
